package com.winit.agent.repository;

import com.winit.agent.model.AgentWorkspace;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface AgentWorkspaceRepository extends CrudRepository<AgentWorkspace, String>{
    @Query(value = "select * from matrix_agent_workspace where 1 = 1 and(?1 is null or ws_id = ?1) and(?2 is null or agent_id = ?2) and(?3 is null or is_default = ?3)", nativeQuery = true)
    List<AgentWorkspace> findByIdAndAgentIdAndIsDefault(String wsId, String agentId, String isDefault);

    List<AgentWorkspace> findByPrdId(String prdId);
}
